package com.core.cloundbusinessapi.sheet.process.enums;


/**
 * @author =====Lqj=====
 * @className CloudSheetProcessStateEnums
 * @description
 * @create 2024/11/28 15:42
 **/

public enum CloudSheetProcessStateEnums {


    TYPE10(10, "系统导入"),
    TYPE11(11, "业务员创建"),
    TYPE12(12, "拆分单"),
    TYPE13(13, "派出"),
    TYPE20(20, "签收"),

    TYPE2020(2020, "一级单位派出"),
    TYPE2021(2021, "一级单位申请办结"),

    TYPE3030(3030, "二级单位派出"),
    TYPE3031(3031, "二级单位申请办结");




    private final Integer code;
    private final String state;

    CloudSheetProcessStateEnums(Integer code, String state) {
        this.code = code;
        this.state = state;
    }

    // 获取 code 值
    public Integer getCode() {
        return code;
    }

    // 获取 state 值
    public String getState() {
        return state;
    }

    /**
     * 通过 code 获取枚举项
     */
    public static Integer getCode(String state) {
        if (state == null) {
            throw new IllegalStateException("响应编码不能为空");
        }
        for (CloudSheetProcessStateEnums resultCode : CloudSheetProcessStateEnums.values()) {
            if (resultCode.getState().equals(state)) {
                return resultCode.getCode();
            }
        }
        throw new IllegalStateException("编码不存请重试输入,不存在的状态：" + state);
    }

}
